import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;

public class Euler217 {

	public static void main(String args[])throws IOException{
		int[] counts=new int[300];
		BufferedImage bi=new BufferedImage(1600,counts.length,1);
		
		int sum=0, val=0;
		for(int i=0; i<1000000; i++){
			val=i; sum=0;
			while(val!=0){
				sum+=(val%10);
				val=val/10;
			}
			counts[sum]++;
		}
		
		PrintStream out=new PrintStream(new FileOutputStream("sums.txt"));
		
		Graphics g=bi.getGraphics();
		for(int i=0; i<counts.length; i++){
			g.drawRect(0,i,counts[i],1);
			out.println(counts[i]);
		}
		
		ImageIO.write(bi, "PNG", new FileOutputStream("sums.png"));
	}

}